﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace OrderingPlatform.WebUI
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            RouteTable.Routes.RouteExistingFiles = false;
            RouteTable.Routes.IgnoreRoute("{resource}.css/{*pathInfo}");
            RouteTable.Routes.IgnoreRoute("{resource}.Content/{*pathInfo}");
            RouteTable.Routes.IgnoreRoute("{resource}.js/{*pathInfo}");
            RouteTable.Routes.IgnoreRoute("{resource}.jpg/{*pathInfo}");
            RouteTable.Routes.IgnoreRoute("{resource}.png/{*pathInfo}");
            RouteTable.Routes.IgnoreRoute("{resource}.gif/{*pathInfo}");
            RouteTable.Routes.IgnoreRoute("{resource}.ico/{*pathInfo}");
            RouteTable.Routes.IgnoreRoute("{folder}/{*pathInfo}", new { folder = "images" });
            routes.MapRoute(
               "Products_List",
               "Products/{controller}/{action}/{category}/{pageIndex}",
               new { category = "", pageIndex = "", action = "Index" },
               new { pageIndex = @"\d+", });

            routes.MapRoute(
                "Default", // 路由名称
                "{controller}/{action}/{id}", // 带有参数的 URL
                new { controller = "Home", action = "Index", id = UrlParameter.Optional }, // 参数默认值
                new[] { "WebUI.Controllers" }
            );
        }
    }
}